package com.tpshion.deploy.common.support;

import com.tpshion.deploy.common.constant.ErrorCode;
import lombok.Data;

@Data
public class BusinessException extends RuntimeException{

    private String code;

    private String msg;

    public BusinessException(String code, String msg){
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BusinessException(ErrorCode errorCode){
        super(errorCode.getMsg());
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

    public BusinessException(String msg){
        super(msg);
        this.code = ErrorCode.FAIL.getCode();
        this.msg = msg;
    }
}
